package com.test.test;

import com.test.domain.fruit.service.fruit.AppleStrategy;
import com.test.domain.fruit.service.fruit.MangoStrategy;
import com.test.domain.fruit.service.fruit.StrawberryStrategy;
import com.test.domain.fruit.service.fruit.differentBuy.DifferentBuy;

import java.util.Scanner;

public class FruitTest03 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        //测试3(草莓打折)：
        //按照苹果、草莓、芒果的顺序输入各自的斤数，并用空格隔开
        System.out.println("按照苹果、草莓、芒果的顺序输入各自的斤数，并用空格隔开（草莓打折）,最后输入草莓的打折力度");

        int appleWeight = scanner.nextInt();

        int strawberryWeight = scanner.nextInt();

        int mangoWeight = scanner.nextInt();

        double strawberryDiscout = scanner.nextDouble();

        DifferentBuy differentBuy = new DifferentBuy();

        // 顾客 C 购买苹果
        differentBuy.setFruitStrategy(new AppleStrategy());
        double totalApple = differentBuy.calculateTotalPrice(appleWeight);
        System.out.println("顾客 C 购买的苹果总价为：" + totalApple + "元");

        // 顾客 C 购买草莓
        differentBuy.setFruitStrategy(new StrawberryStrategy());
        double totalStrawberry = differentBuy.calcuateTotalPriceByDiscout(strawberryWeight,strawberryDiscout);
        System.out.println("顾客 C 购买的草莓总价为：" + totalStrawberry + "元");

        // 顾客 C 购买芒果
        differentBuy.setFruitStrategy(new MangoStrategy());
        double totalMango = differentBuy.calculateTotalPrice(mangoWeight);
        System.out.println("顾客 C 购买的芒果总价为：" + totalMango + "元");

        System.out.println("顾客 C 购买的水果总价为：" + (totalApple + totalStrawberry + totalMango) + "元" );

    }
}
